package com.yuqian.JavaSe.leetcode.easy;
/**
 * Invert a binary tree.

     4
   /   \
  2     7
 / \   / \
1   3 6   9
to
     4
   /   \
  7     2
 / \   / \
9   6 3   1
 * @author yuqian
 *
 */
public class InvertBinaryTree {
    public TreeNode invertTree(TreeNode root) {
        if(root==null){
            return root;
        }
        if(root.right==null&&root.left==null){
            return root;
        }else{
        	//倒置左右子树
            TreeNode rightNode = invertTree(root.right);
            TreeNode leftNode = invertTree(root.left);
            //倒置左右节点
            root.right = leftNode;
            root.left = rightNode;
            return root;
        }
    }
    private  class TreeNode {
	      int val;
	      TreeNode left;
	      TreeNode right;
	      TreeNode(int x) { val = x; } 
    }
    
    public void moveZeroes(int[] nums) {
        if(nums==null||nums.length==0){
        	
        }
    }
}
